package com.aoip.telemetry.telemetry.mq.rabbitmq;

import org.springframework.amqp.core.AmqpTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;


/**
 * @author chenbai
 * @version 1.0
 * @date 2021/6/17 9:52
 */
@Service
public class SendMsgToRabbitMq {

    @Autowired
    private AmqpTemplate template;

    /**
     * 发送消息到消息中间件
     *
     * @param exchange 交换机名称
     * @param router   路由键名称
     * @param msg      消息对象
     * @author chenbai
     * @date 2021/11/17
     **/
    public void sendMsg(String exchange, String router, String msg) {
        template.convertAndSend(exchange, router, msg);
    }

}
